package com.fzj.wxpay_demo.controller;

import com.fzj.wxpay_demo.base.response.JsonResult;
import com.fzj.wxpay_demo.entity.Product;
import com.fzj.wxpay_demo.service.ProductService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/api/product")
@RestController
@Slf4j
public class ProductController {
    @Autowired
    private ProductService productService;

    @ApiOperation("商品列表")
    @GetMapping("list")
    public JsonResult list(){

        List<Product> productList = productService.list();
        log.debug("商品列表，响应数据：{}",productList);
        return JsonResult.ok(productList);
    }
}
